import request from '@/utils/request'
const api_name = '/chapter'

export default {
    getTreeList(courseId) {
        return request({
            url: `${api_name}/treelist/${courseId}`,
            method: 'get'
        })
    },
    //添加课程章节
    addChapter(chapter) {
        return request({
            url: `${api_name}`,
            method: 'post',
            data: chapter
        })
    },
    //根据id获取章节信息
    getChapter(id) {
        return request({
            url: `${api_name}/${id}`,
            method: 'get',
        })
    },
    //更新课程章节
    undateChapter(chapter) {
        return request({
            url: `${api_name}/${chapter.id}`,
            method: 'put',
            data: chapter
        })
    },
    deleteById(id) {
        return request({
            url: `${api_name}/${id}`,
            method: 'delete',
        })
    }
}